<template>
  <div class="finance">
    <div class="finance__tabs">
      <label v-for="(item, index) in tabItem " :key="index">
        <input type="radio" name="btn" :checked="index === 0" @click="tabIndex = index">
        <div>{{ item }}</div>
      </label>
    </div>
    <div class="finance__content">
      <component :is="[business,goodsSale,warehouse,customer][tabIndex]"></component>
    </div>
  </div>
</template>

<script setup>
import {ref} from 'vue';
import business from './business/index.vue';
import goodsSale from './goods-sale/index.vue';
import warehouse from './warehouse/index.vue';
import customer from './customer/index.vue';

let tabIndex = ref(0);
const tabItem = ['营业', '商品销售', '库房', '顾客'];
</script>

<style lang="less" scoped>
.finance {
  display: flex;
  flex-direction: column;
  height: 100%;

  &__tabs {
    display: flex;
    width: 100%;
    padding: 20px 30px;
    border-bottom: 10px solid #ececec;
    box-sizing: border-box;

    > label {
      margin-right: 18px;

      > input {
        display: block;
        width: 0;
        height: 0;
        opacity: 0;
      }

      > input + div {
        width: 158px;
        height: 60px;
        font-size: 24px;
        color: #666;
        background: #f8f8f8;
        box-shadow: 0 0 0 1px #e5e5e5;
        border-radius: 5px;
        text-align: center;
        line-height: 60px;
      }

      > input + div + div {
        position: absolute;
        display: none;
        width: 100%;
        left: 0;
        margin-top: 30px;
      }

      > input:checked + div {
        color: #fff;
        background: #1981f4;
        box-shadow: none;
      }
    }
  }

  &__content {
    flex: 1;
    overflow-y: auto;
  }
}
</style>
